import { Router } from 'express';
import settingsController from '@controllers/settings.controller';
import { authenticate } from '@middleware/auth';

const router = Router();

/**
 * @route   GET /api/settings/user
 * @desc    Get current user's settings
 * @access  Private
 */
router.get('/user', authenticate, settingsController.getUserSettings);

/**
 * @route   GET /api/settings/user/:userId
 * @desc    Get specific user's settings
 * @access  Private
 */
router.get('/user/:userId', authenticate, settingsController.getUserSettings);

/**
 * @route   GET /api/settings/preferences
 * @desc    Get current user's preferences
 * @access  Private
 */
router.get('/preferences', authenticate, settingsController.getUserPreferences);

/**
 * @route   PUT /api/settings/preferences
 * @desc    Update current user's preferences
 * @access  Private
 */
router.put('/preferences', authenticate, settingsController.updateUserPreferences);

/**
 * @route   PUT /api/settings/user
 * @desc    Update user setting
 * @access  Private
 */
router.put('/user', authenticate, settingsController.updateUserSetting);

/**
 * @route   DELETE /api/settings/user
 * @desc    Reset user settings to defaults
 * @access  Private
 */
router.delete('/user', authenticate, settingsController.resetUserSettings);

/**
 * @route   GET /api/settings/system
 * @desc    Get system settings
 * @access  Private
 */
router.get('/system', authenticate, settingsController.getSystemSettings);

/**
 * @route   GET /api/settings/system/config
 * @desc    Get system config
 * @access  Private
 */
router.get('/system/config', authenticate, settingsController.getSystemConfig);

/**
 * @route   PUT /api/settings/system/config
 * @desc    Update system config
 * @access  Private (Admin only)
 */
router.put('/system/config', authenticate, settingsController.updateSystemConfig);

/**
 * @route   PUT /api/settings/system
 * @desc    Update system setting
 * @access  Private (Admin only)
 */
router.put('/system', authenticate, settingsController.updateSystemSetting);

/**
 * @route   DELETE /api/settings/system
 * @desc    Reset system settings to defaults
 * @access  Private (Admin only)
 */
router.delete('/system', authenticate, settingsController.resetSystemSettings);

/**
 * @route   GET /api/settings/integrations
 * @desc    Get integration settings
 * @access  Private
 */
router.get('/integrations', authenticate, settingsController.getIntegrationSettings);

/**
 * @route   GET /api/settings/integrations/config
 * @desc    Get integration config
 * @access  Private
 */
router.get('/integrations/config', authenticate, settingsController.getIntegrationConfig);

/**
 * @route   PUT /api/settings/integrations
 * @desc    Update integration setting
 * @access  Private (Admin only)
 */
router.put('/integrations', authenticate, settingsController.updateIntegrationSetting);

/**
 * @route   GET /api/settings/notifications/channels
 * @desc    Get notification channels
 * @access  Private
 */
router.get('/notifications/channels', authenticate, settingsController.getNotificationChannels);

/**
 * @route   PUT /api/settings/notifications/channels
 * @desc    Update notification channels
 * @access  Private (Admin only)
 */
router.put('/notifications/channels', authenticate, settingsController.updateNotificationChannels);

export default router;
